<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/common/header.jsp"%>
<html>
<body class="easyui-layout list_body">
<form id="menuForm" name="menuForm">
	<div class="list_body_north" data-options="region:'north'" border="false">
	    <!-- 查询表单 -->
	    <div style="padding: 3px" class="easyui-panel datagrid-toolbar">
	        <div>
	            <span>清算开始日期:</span>
	            <input type="text" id="loc_dt_start" name="loc_dt_start" class="easyui-datebox" data-options="editable:false" value="${yestedayDate}"/>
	            <span>清算结束日期:</span>
	            <input type="text" id="loc_dt_end" name="loc_dt_end" class="easyui-datebox" data-options="editable:false" value="${yestedayDate}"/>
	            <span>机构号:</span>
	            <input type="text" id="ins_cd" name="ins_cd" class="easyui-textbox" />
	            <span>机构名称:</span>
	            <input type="text" id="ins_name" name="ins_name" class="easyui-textbox" />
	            <a href="#" class="easyui-linkbutton btn" iconCls="icon-search" onclick="doSearch()">查询</a>
	            <a href="#" class="easyui-linkbutton btn" iconCls="icon-reload" onclick="resetForm()">重置</a>
	        </div>
	    </div>
	    <!-- 维护汇总数据 -->
	    <div style="padding: 3px" class="easyui-panel datagrid-toolbar">交易金额：<span id="all_amt"></span></div>
	    <jiepos:buttonOperateTag menuCode="${menuCode }"></jiepos:buttonOperateTag>
    </div>
    <div data-options="region:'center'" border="false" class="list_body_center">
	    <!-- 表格 -->
	    <table id="menuTableId" fit="true"></table>
    </div>
</form>
</body>
<script type="text/javascript">
    var grid;
    $(function() {
    	getTotalInfo();
        /*加载表格数据*/
        grid = $("#menuTableId").jpgrid({
            url : "getInsAccountChangeListSumJson.do",
            baseColumns: false,
            columns : [ {
                title : "变动日期",
                field : "LOC_DT",
                align : 'center',
                width:100
            }, {
                title : "所属机构",
                field : "INS_NAME",
                align : 'center'
            }, {
                title : "业务名称",
                field : "SERVICE_NAME",
                align : 'center'
            }, {
                title : "业务参数名称",
                field : "SERVICE_PARAM_NAME",
                align : 'center'
            }, {
                title : "变动金额",
                field : "AMOUNT",
                align : 'center',
                width:100
            }, {
                title : "备注",
                field : "REMARKS",
                align : 'center'
            }],
            queryParams: getQueryParams()
        });
    });

    function doSearch() {
        grid.load(getQueryParams());
        getTotalInfo();
    }
    
    function exportFile(url){
        var checkedItems = $('#menuTableId').datagrid('getChecked');
        if(!checkedItems){
            return false;
        };
        commonFileDownload(url, "menuForm");
    }
    
    function getTotalInfo(){
        $.ajax({
            url : '../insAccountChange/getInsAccountChangeTotal.do',
            data : getQueryParams(),
            success : function(result) {
                $("#all_amt").html(result.ALL_AMT);
            }
        });
    }
    
    function getQueryParams(){
    	var data = {
        	loc_dt_start : $('#loc_dt_start').val(),
        	loc_dt_end : $('#loc_dt_end').val(),
            ins_cd : $('#ins_cd').val(),
            ins_name : $('#ins_name').val(),
        };
		return data;
    }
</script>
</html>
